package net.digitalartwork.ui{
	
	import flash.display.*;
	
	public class SunDraw extends Sprite{
		
		public var vars:Object; 
		public var shapebg = new Sprite();
		public var shape = new Sprite();
		//public function SunDraw(shapeType:String, shapeWidth:Number,shapeHeight:Number, shapeLineThickness:Number, hexFill:Number, hexLine:Number, shapeRadius:Number, shapeFillAlpha:Number, shapeLineAlpha) {
		public function SunDraw($vars:Object) {
			this.vars = $vars;
			
			addChild(shapebg);
			addChild(shape);
			shape.alpha = this.vars.shapeFillAlpha;
			
			switch (this.vars.shapeType) { 
				
			    case "rectangle" :
					shape.graphics.beginFill(this.vars.hexFill, this.vars.shapeFillAlpha2);
					shape.graphics.lineStyle(this.vars.shapeLineThickness, this.vars.hexLine, this.vars.shapeLineAlpha, true);
					shape.graphics.drawRect(0, 0, this.vars.shapeWidth, this.vars.shapeHeight);
					if (this.vars.makeBG == "true") {
						shapebg.graphics.beginFill(0xFFFFFF);
						shapebg.graphics.lineStyle(this.vars.shapeLineThickness, 0x000000, this.vars.shapeLineAlpha, true);
						shapebg.graphics.drawRect(0, 0, this.vars.shapeWidth, this.vars.shapeHeight);
					}
					break; 
			    case "circle" : 
					shape.graphics.beginFill(this.vars.hexFill);
					shape.graphics.lineStyle(this.vars.shapeLineThickness, this.vars.hexLine, this.vars.shapeLineAlpha, true);
					shape.graphics.drawCircle(0, 0, this.vars.shapeRadius);
					if (this.vars.makeBG == "true") {
						shapebg.graphics.beginFill(0xFFFFFF);
						shapebg.graphics.lineStyle(this.vars.shapeLineThickness, 0xFFFFFF, this.vars.shapeLineAlpha, true);
						shapebg.graphics.drawCircle(0, 0, this.vars.shapeRadius);
					}
					break; 
				
			    case "roundedrectangle" : 
					shape.graphics.beginFill(this.vars.hexFill);
					shape.graphics.lineStyle(this.vars.shapeLineThickness, this.vars.hexLine, this.vars.shapeLineAlpha, true);
					shape.graphics.drawRoundRect(0, 0, this.vars.shapeWidth, this.vars.shapeHeight, this.vars.shapeRadius, this.vars.shapeRadius);
					if (this.vars.makeBG == "true") {
						shapebg.graphics.beginFill(0xFFFFFF);
						shapebg.graphics.lineStyle(this.vars.shapeLineThickness, 0xFFFFFF, this.vars.shapeLineAlpha, true);
						shapebg.graphics.drawRoundRect(0, 0, this.vars.shapeWidth, this.vars.shapeHeight, this.vars.shapeRadius, this.vars.shapeRadius);
					}
					break;
				case "triangle" :
					shape.graphics.beginFill(this.vars.hexFill);
					shape.graphics.lineStyle(this.vars.shapeLineThickness, this.vars.hexLine, this.vars.shapeLineAlpha, true);
					shape.graphics.moveTo(0, 0);
					shape.graphics.lineTo(this.vars.shapeWidth, (this.vars.shapeHeight/2));
					shape.graphics.lineTo(0, this.vars.shapeHeight);
					shape.graphics.endFill();
					if (this.vars.makeBG == "true") {
						shapebg.graphics.beginFill(0xFFFFFF);
						shapebg.graphics.lineStyle(this.vars.shapeLineThickness, 0xFFFFFF, this.vars.shapeLineAlpha, true);
						shapebg.graphics.moveTo(0, 0);
						shapebg.graphics.lineTo(this.vars.shapeWidth, (this.vars.shapeHeight/2));
						shapebg.graphics.lineTo(0, this.vars.shapeHeight);
						shapebg.graphics.endFill();
					}
					break;
			    default : 
			        trace("SunDraw: No ShapeType Defined"); 
				break;
				
			}
		}
		public function getVars(varName):String {
			return this.vars[varName];
			//return "dude"
		}
		public function setVars(varName, varValue):void {
			this.vars[varName] = varValue;
			//return "dude"
		}
		
	}
	
}

